import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(
    title: 'Flutter第三天',
    home: MyButton(),
  ));
}

class MyButton extends StatelessWidget {
  const MyButton({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        print('MyButton被监听了');
      },
      child: Container(
        height: 36.0,
        padding: const EdgeInsets.all(8.0),
        margin: const EdgeInsets.symmetric(horizontal: 8.0),
        decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(5.0),
            color: Colors.lightGreen
        ),
        child: const Center(child: Text('点击监听'),),
      ),
    );
  }
}
